/* HOLZBAU AI Chat Widget Styles */

:root {
    --chat-green: #2B6D3C;
    --chat-green-hover: #266035;
    --chat-bg-glass: rgba(255, 255, 255, 0.75);
    --chat-border-glass: rgba(255, 255, 255, 0.4);
    --chat-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    --chat-radius: 24px;
    --chat-radius-msg: 16px;
    --chat-font: 'Inter', sans-serif;
    --chat-font-heading: 'Montserrat', sans-serif;
    --chat-text-dark: #17201b;
    --chat-text-muted: #6f766f;
}

/* Floating Trigger Button */
.holz-chat-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    color: white;
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.3), 
        inset 0 -2px 4px rgba(0, 0, 0, 0.2), 
        0 10px 30px rgba(43, 109, 60, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                border-radius 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                transform 0.3s ease;
    overflow: hidden; /* Clip shimmer and border beam */
    white-space: nowrap;
    padding: 1px;
}

/* Volumetric Inner Background */
.holz-chat-trigger-bg {
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, #378249 0%, #20532E 100%);
    z-index: 2;
    pointer-events: none;
    box-shadow: 
        inset 0 1px 3px rgba(255, 255, 255, 0.3), 
        inset 0 -1px 3px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease;
}

.holz-chat-trigger:hover .holz-chat-trigger-bg {
    background: linear-gradient(135deg, #3f9453 0%, #256035 100%);
}

/* Border Beam Emitter (conic gradient) */
.holz-chat-border-beam-emitter {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 380px;
    height: 380px;
    margin-top: -190px;
    margin-left: -190px;
    background: conic-gradient(
        from 0deg,
        transparent 65%,
        #3ae067 80%,      /* Vibrant green */
        #D4AF37 95%,      /* Rich gold */
        transparent 100%
    );
    animation: borderBeamSpin 4s linear infinite;
    z-index: 1;
    pointer-events: none;
    transform-origin: center center;
}

@keyframes borderBeamSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulsing Halos (Aura) */
.holz-chat-trigger::before,
.holz-chat-trigger::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: inherit;
    border: 1px solid var(--chat-green);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    animation: triggerPulse 3s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

.holz-chat-trigger::after {
    animation-delay: 1.5s;
}

@keyframes triggerPulse {
    0% { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.35); opacity: 0; }
}

/* Shimmer sweep effect */
.holz-chat-trigger-shimmer {
    position: absolute;
    top: 0;
    left: -150%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    pointer-events: none;
    animation: buttonShimmer 6s infinite ease-in-out;
    z-index: 4;
}

@keyframes buttonShimmer {
    0%, 75% { left: -150%; }
    100% { left: 150%; }
}

.holz-chat-trigger:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.3), 
        inset 0 -2px 4px rgba(0, 0, 0, 0.2), 
        0 15px 35px rgba(43, 109, 60, 0.5);
}

.holz-chat-trigger:active {
    transform: scale(0.96) translateY(-1px);
}

/* Trigger Icon Container */
.holz-chat-trigger-icon-container {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 3;
}

.holz-chat-trigger svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: all 0.4s ease;
}

.holz-chat-trigger .holz-chat-icon-close {
    position: absolute;
    opacity: 0;
    transform: scale(0.7) rotate(-45deg);
}

.holz-chat-trigger .holz-chat-icon-chat {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Open State icon transitions */
.holz-chat-trigger.open .holz-chat-icon-chat {
    opacity: 0;
    transform: scale(0.7) rotate(45deg);
}

.holz-chat-trigger.open .holz-chat-icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Expanding Text Group */
.holz-chat-trigger-text-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 3;
    white-space: nowrap;
}

.holz-chat-trigger-title {
    font-family: var(--chat-font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.25;
    letter-spacing: 0.02em;
}

.holz-chat-trigger-subtitle {
    font-family: var(--chat-font);
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.25;
    margin-top: 1px;
    letter-spacing: 0.01em;
}

/* Media query to expand button only on desktop */
@media (min-width: 769px) {
    .holz-chat-trigger.expanded {
        width: 300px;
        justify-content: flex-start;
    }
    .holz-chat-trigger.expanded .holz-chat-trigger-icon-container {
        margin-left: 15px; /* Offset the icon container from the left edge */
        transform: scale(1.05);
    }
    .holz-chat-trigger.expanded .holz-chat-trigger-text-group {
        opacity: 1;
        max-width: 240px;
        margin-left: 10px; /* Space between icon and text group */
    }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    .holz-chat-trigger::before,
    .holz-chat-trigger::after,
    .holz-chat-trigger-shimmer,
    .holz-chat-border-beam-emitter {
        animation: none !important;
        opacity: 0 !important;
    }
    .holz-chat-trigger,
    .holz-chat-trigger-text-group,
    .holz-chat-trigger-icon-container,
    .holz-chat-trigger-bg {
        transition: none !important;
    }
    .holz-chat-trigger:hover,
    .holz-chat-trigger:active {
        transform: none !important;
    }
}

/* Chat Window Container (Frosted Liquid Glassmorphism) */
.holz-chat-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 400px;
    height: 580px;
    max-height: calc(100vh - 140px);
    border-radius: var(--chat-radius);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.18) 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.12), 
        0 0 40px rgba(43, 109, 60, 0.05), 
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.holz-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Chat Header */
.holz-chat-header {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
}

.holz-chat-mascot {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid rgba(212, 175, 55, 0.5); /* Soft gold border matching theme */
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.25),
        0 6px 15px rgba(43, 109, 60, 0.15);
    background: #0d120f;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s ease;
}

.holz-chat-mascot:hover {
    border-color: rgba(212, 175, 55, 0.8);
    transform: scale(1.05);
}

/* ======================================================
   MINI AVATAR (PNG) IN HEADER — Simple state-based effects
   ====================================================== */

.hobi-avatar-mini {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    transition: filter 0.4s ease, transform 0.4s ease;
}

/* Idle: gentle breathing */
.holz-chat-mascot.idle .hobi-avatar-mini {
    animation: hobiMiniBreathe 4s ease-in-out infinite;
}

@keyframes hobiMiniBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Greeting: excited bounce */
.holz-chat-mascot.greeting .hobi-avatar-mini {
    animation: hobiMiniBounce 0.6s ease-in-out 3;
}

.holz-chat-mascot.greeting {
    animation: hobiMiniGreetGlow 0.8s ease-out 1;
}

@keyframes hobiMiniBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.08) rotate(-5deg); }
}

@keyframes hobiMiniGreetGlow {
    0% { box-shadow: inset 0 2px 4px rgba(255,255,255,0.25), 0 6px 15px rgba(43,109,60,0.15), 0 0 0 0 rgba(212,175,55,0.6); }
    50% { box-shadow: inset 0 2px 4px rgba(255,255,255,0.25), 0 6px 15px rgba(43,109,60,0.15), 0 0 20px 4px rgba(212,175,55,0.35); }
    100% { box-shadow: inset 0 2px 4px rgba(255,255,255,0.25), 0 6px 15px rgba(43,109,60,0.15), 0 0 0 0 rgba(212,175,55,0); }
}

/* Thinking: float + green glow pulse */
.holz-chat-mascot.thinking .hobi-avatar-mini {
    animation: hobiMiniFloat 2s ease-in-out infinite, hobiMiniThinkGlow 1.5s ease-in-out infinite;
}

@keyframes hobiMiniFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes hobiMiniThinkGlow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 2px rgba(58,224,103,0.15)); }
    50% { filter: brightness(1.1) drop-shadow(0 0 8px rgba(58,224,103,0.6)); }
}

/* Speaking: nod + bright */
.holz-chat-mascot.speaking .hobi-avatar-mini {
    animation: hobiMiniNod 0.5s ease-in-out infinite;
    filter: brightness(1.05);
}

@keyframes hobiMiniNod {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-1.5px) scale(1.02); }
}

/* Reduced motion for mini avatar */
@media (prefers-reduced-motion: reduce) {
    .hobi-avatar-mini {
        animation: none !important;
        filter: none !important;
    }
    .holz-chat-mascot.greeting,
    .holz-chat-mascot.thinking,
    .holz-chat-mascot.speaking,
    .holz-chat-mascot.idle {
        animation: none !important;
    }
}

/* ======================================================
   FLOATING 3D ROBOT — Парящий помощник рядом с чатом
   ====================================================== */

.hobi-floating-robot {
    position: fixed;
    bottom: 305px;        /* Выровнено по центру окна чата по вертикали (на уровне глаз) */
    right: 445px;         /* Чуть левее окна чата (400px + 30px right + gap) */
    width: 180px;
    height: 180px;
    z-index: 9997;
    pointer-events: none;
    opacity: 0;
    transform: translateY(40px) scale(0.6);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    /* Persistent gentle levitation */
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.15));
}

.hobi-floating-robot.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: hobiRobotLevitate 3.5s ease-in-out infinite;
    animation-delay: 0.6s; /* Start after entry transition */
}

/* Levitation keyframes */
@keyframes hobiRobotLevitate {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.01); }
}

/* Green ambient glow under robot */
.hobi-floating-glow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(58, 224, 103, 0.35) 0%, transparent 70%);
    border-radius: 50%;
    animation: hobiGlowPulse 3.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hobiGlowPulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scaleX(1); }
    50% { opacity: 1; transform: translateX(-50%) scaleX(1.3); }
}

/* 3D Scene Setup */
.hobi-3d-scene {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.hobi-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.1s ease-out;
}

.hobi-layer-arm-r {
    z-index: 1;
}

.hobi-layer-body {
    z-index: 2;
}

.hobi-layer-arm-l {
    z-index: 3;
}

.hobi-layer-head {
    z-index: 4;
}

.hobi-layer img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-style: preserve-3d;
    will-change: transform;
}

.hobi-layer-head .hobi-head-img {
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}

.hobi-floating-robot:not([data-state]) .hobi-head-idle,
.hobi-floating-robot[data-state="idle"] .hobi-head-idle,
.hobi-floating-robot[data-state="greeting"] .hobi-head-idle,
.hobi-floating-robot[data-state="thinking"] .hobi-head-thinking,
.hobi-floating-robot[data-state="speaking"] .hobi-head-speaking {
    opacity: 1;
    visibility: visible;
}

/* Layer specific transform origins for animations */
.hobi-layer-head img {
    transform-origin: 50% 80%;
}

.hobi-layer-arm-l img {
    transform-origin: 65% 50%;
}

.hobi-layer-arm-r img {
    transform-origin: 35% 50%;
}

.hobi-layer-body img {
    transform-origin: 50% 50%;
    will-change: filter;
}

/* ======================================================
   STATE ANIMATIONS (applied to internal <img> elements)
   ====================================================== */

/* IDLE state (default) */
.hobi-floating-robot[data-state="idle"] .hobi-layer-body img,
.hobi-floating-robot:not([data-state]) .hobi-layer-body img {
    animation: hobiBreathe 3.8s ease-in-out infinite;
}

.hobi-floating-robot[data-state="idle"] .hobi-head-idle,
.hobi-floating-robot:not([data-state]) .hobi-head-idle {
    animation: hobiHeadTilt 4.4s ease-in-out infinite, hobiBlink 4.5s ease-in-out infinite;
}

.hobi-floating-robot[data-state="idle"] .hobi-layer-arm-l img,
.hobi-floating-robot:not([data-state]) .hobi-layer-arm-l img {
    --hobi-arm-l-gesture: 0.6deg;
    animation: hobiTalkGesture 4.8s ease-in-out infinite;
}

.hobi-floating-robot[data-state="idle"] .hobi-layer-arm-r img,
.hobi-floating-robot:not([data-state]) .hobi-layer-arm-r img {
    --hobi-arm-r-gesture: -0.6deg;
    animation: hobiTalkGestureR 5s ease-in-out infinite;
}

@keyframes hobiBreathe {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.025); }
}

@keyframes hobiBlink {
    0%, 92%, 100% { filter: brightness(1); }
    95% { filter: brightness(0.82); }
    97% { filter: brightness(1.08); }
}

@keyframes hobiHeadTilt {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.03); }
}

@keyframes hobiTalkGesture {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(var(--hobi-arm-l-gesture, 1.2deg)); }
}

@keyframes hobiTalkGestureR {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(var(--hobi-arm-r-gesture, -1.2deg)); }
}

/* GREETING state */
.hobi-floating-robot[data-state="greeting"] .hobi-layer-arm-r img {
    animation: hobiWave 0.62s ease-in-out infinite;
}

.hobi-floating-robot[data-state="greeting"] .hobi-head-idle {
    animation: hobiHeadTilt 1.2s ease-in-out infinite, hobiBlink 4.5s ease-in-out infinite;
}

.hobi-floating-robot[data-state="greeting"] .hobi-layer-body img {
    animation: hobiBreathe 1.2s ease-in-out infinite;
}

@keyframes hobiWave {
    0%, 100% { transform: rotate(0deg); }
    18% { transform: rotate(-34deg); }
    36% { transform: rotate(-9deg); }
    56% { transform: rotate(-34deg); }
    76% { transform: rotate(-10deg); }
}

/* THINKING state */
.hobi-floating-robot[data-state="thinking"] {
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.15))
            drop-shadow(0 0 12px rgba(58, 224, 103, 0.25));
    animation: hobiEyePulse 2s ease-in-out infinite;
}

.hobi-floating-robot[data-state="thinking"] .hobi-head-thinking {
    animation: hobiFloatHead 3s ease-in-out infinite, hobiMicPulse 1.8s ease-in-out infinite;
}

.hobi-floating-robot[data-state="thinking"] .hobi-layer-arm-l img {
    --hobi-arm-l-gesture: 1deg;
    animation: hobiTalkGesture 3s ease-in-out infinite;
}

.hobi-floating-robot[data-state="thinking"] .hobi-layer-arm-r img {
    --hobi-arm-r-gesture: -1deg;
    animation: hobiTalkGestureR 3s ease-in-out infinite;
}

.hobi-floating-robot[data-state="thinking"] .hobi-layer-body img {
    animation: hobiFloatBody 3s ease-in-out infinite;
}

@keyframes hobiEyePulse {
    0%, 100% { filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.15)) drop-shadow(0 0 12px rgba(58, 224, 103, 0.25)); }
    50% { filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.15)) drop-shadow(0 0 20px rgba(58, 224, 103, 0.45)); }
}

@keyframes hobiFloatHead {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 7px rgba(58, 224, 103, 0.18)); }
    50% { filter: brightness(1.08) drop-shadow(0 0 14px rgba(58, 224, 103, 0.38)); }
}

@keyframes hobiFloatBody {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.018); }
}

@keyframes hobiMicPulse {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 7px rgba(58, 224, 103, 0.24)); }
    50% { filter: brightness(1.12) drop-shadow(0 0 14px rgba(58, 224, 103, 0.48)); }
}

/* SPEAKING state */
.hobi-floating-robot[data-state="speaking"] .hobi-head-speaking {
    animation: hobiHeadNod 0.5s ease-in-out infinite, hobiBlink 4.5s ease-in-out infinite;
}

.hobi-floating-robot[data-state="speaking"] .hobi-layer-arm-l img {
    --hobi-arm-l-gesture: 2.5deg;
    animation: hobiTalkGesture 0.7s ease-in-out infinite;
}

.hobi-floating-robot[data-state="speaking"] .hobi-layer-arm-r img {
    --hobi-arm-r-gesture: -2.5deg;
    animation: hobiTalkGestureR 0.7s ease-in-out infinite;
}

.hobi-floating-robot[data-state="speaking"] .hobi-layer-body img {
    animation: hobiBreathe 0.5s ease-in-out infinite;
}

@keyframes hobiHeadNod {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.05); }
}

/* ======================================================
   FLOATING ROBOT — Mobile Responsive
   ====================================================== */
@media (max-width: 768px) {
    /* На мобильных робот скрыт — чат занимает весь экран */
    .hobi-floating-robot {
        display: none;
    }
}

/* Tablets / narrow desktop — robot goes above chat window */
@media (min-width: 769px) and (max-width: 1100px) {
    .hobi-floating-robot {
        right: auto;
        left: 50%;
        bottom: auto;
        top: 20px;
        transform: translateX(-50%) translateY(40px) scale(0.5);
        width: 120px;
        height: 120px;
    }
    .hobi-floating-robot.visible {
        transform: translateX(-50%) translateY(0) scale(1);
        animation: hobiRobotLevitateCentered 3.5s ease-in-out infinite;
        animation-delay: 0.6s;
    }
    @keyframes hobiRobotLevitateCentered {
        0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
        50% { transform: translateX(-50%) translateY(-8px) scale(1.01); }
    }
}

/* Floating Robot — Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .hobi-floating-robot,
    .hobi-floating-robot.visible {
        animation: none !important;
    }
    .hobi-layer img {
        animation: none !important;
    }
    .hobi-layer {
        transition: none !important;
    }
    .hobi-floating-glow {
        animation: none !important;
    }
}

.holz-chat-header-info {
    flex: 1;
}

.holz-chat-clear-btn {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 10px;
    color: var(--chat-green);
    opacity: 0.75;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.holz-chat-clear-btn svg {
    width: 18px;
    height: 18px;
}

.holz-chat-clear-btn:hover {
    opacity: 1;
    background: rgba(43, 109, 60, 0.1);
    transform: scale(1.05);
}

/* Glassmorphism tooltip — liquid glass premium */
.holz-chat-clear-tooltip {
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    transform: translateY(-50%) translateX(6px);
    background: rgba(23, 32, 27, 0.88);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
    z-index: 9999;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    letter-spacing: 0.2px;
}

/* Arrow pointing right to the button */
.holz-chat-clear-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(23, 32, 27, 0.88);
}

.holz-chat-clear-btn:hover .holz-chat-clear-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.holz-chat-title {
    font-family: var(--chat-font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--chat-text-dark);
}

.holz-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--chat-text-muted);
}

.holz-chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Chat Messages Content Area */
.holz-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for messages */
.holz-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.holz-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.holz-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* Message Bubbles */
.holz-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    font-family: var(--chat-font);
    font-size: 0.92rem;
    line-height: 1.45;
}

.holz-message.user {
    align-self: flex-end;
}

.holz-message.assistant {
    align-self: flex-start;
}

.holz-message-bubble {
    padding: 12px 18px;
    border-radius: var(--chat-radius-msg);
}

.holz-message.user .holz-message-bubble {
    background: linear-gradient(135deg, #378249 0%, #20532E 100%);
    color: white;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 4px 12px rgba(43, 109, 60, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.holz-message.assistant .holz-message-bubble {
    background: rgba(255, 255, 255, 0.45);
    color: var(--chat-text-dark);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* Links inside bot messages */
.holz-message-bubble a {
    color: var(--chat-green);
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.holz-message-bubble a:hover {
    color: var(--chat-green-hover);
}

.holz-message.user .holz-message-bubble a {
    color: white;
    text-decoration: underline;
}

.holz-message-time {
    font-size: 0.75rem;
    color: var(--chat-text-muted);
    margin-top: 4px;
    padding: 0 6px;
}

.holz-message.user .holz-message-time {
    align-self: flex-end;
}

/* User Agreement Notice Block */
.holz-chat-agreement {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    font-size: 0.82rem;
    color: var(--chat-text-dark);
    text-align: center;
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    margin-bottom: 8px;
}

.holz-chat-agreement-text {
    line-height: 1.4;
    margin-bottom: 12px;
}

.holz-chat-agreement-text a {
    color: var(--chat-green);
    text-decoration: underline;
}

.holz-chat-agreement-btn {
    background: var(--chat-green);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.holz-chat-agreement-btn:hover {
    background: var(--chat-green-hover);
    transform: translateY(-1px);
}

/* Typing Indicator Animation */
.holz-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
}

.holz-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-text-muted);
    border-radius: 50%;
    opacity: 0.6;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.holz-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.holz-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Form Area */
.holz-chat-form {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.18);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    gap: 10px;
    align-items: center;
}

.holz-chat-input-wrapper {
    flex: 1;
    position: relative;
}

.holz-chat-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.45);
    font-family: var(--chat-font);
    font-size: 0.92rem;
    outline: none;
    color: var(--chat-text-dark);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.holz-chat-input:focus {
    border-color: var(--chat-green);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(43, 109, 60, 0.12);
}

.holz-chat-input:disabled {
    background: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    color: var(--chat-text-muted);
}

/* Conditional Project Upload Panel */
.holz-chat-upload-panel {
    margin: 0 20px 12px;
    padding: 12px;
    max-height: min(42vh, 330px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(43, 109, 60, 0.16);
    border-radius: 16px;
    box-shadow:
        0 14px 28px rgba(23, 32, 27, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: var(--chat-font);
}

.holz-chat-upload-panel.is-phone-mode {
    max-height: min(30vh, 230px);
}

.holz-chat-upload-panel.is-phone-mode .holz-chat-upload-grid {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}

.holz-chat-upload-panel.is-phone-mode .holz-chat-upload-drop,
.holz-chat-upload-panel.is-phone-mode .holz-chat-upload-input,
.holz-chat-upload-panel.is-phone-mode #holzChatUploadFileError {
    display: none;
}

.holz-chat-upload-panel::-webkit-scrollbar {
    width: 5px;
}

.holz-chat-upload-panel::-webkit-scrollbar-track {
    background: transparent;
}

.holz-chat-upload-panel::-webkit-scrollbar-thumb {
    background: rgba(43, 109, 60, 0.22);
    border-radius: 999px;
}

.holz-chat-upload-panel[hidden] {
    display: none;
}

.holz-chat-upload-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.holz-chat-upload-title {
    color: var(--chat-text-dark);
    font-family: var(--chat-font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}

.holz-chat-upload-note,
.holz-chat-upload-file {
    color: var(--chat-text-muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.holz-chat-upload-close {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(43, 109, 60, 0.14);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.66);
    color: var(--chat-text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    flex: 0 0 auto;
}

.holz-chat-upload-close:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.holz-chat-upload-close svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.holz-chat-upload-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.holz-chat-upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.holz-chat-upload-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.holz-chat-upload-field label {
    color: var(--chat-text-dark);
    font-size: 0.76rem;
    font-weight: 700;
}

.holz-chat-upload-field input,
.holz-chat-upload-field textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(43, 109, 60, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--chat-text-dark);
    font-family: var(--chat-font);
    font-size: 0.88rem;
    line-height: 1.35;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.holz-chat-phone-control {
    display: flex;
    align-items: center;
    min-height: 42px;
    border: 1px solid rgba(43, 109, 60, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.holz-chat-phone-prefix {
    display: flex;
    align-items: center;
    align-self: stretch;
    padding: 0 10px 0 12px;
    background: rgba(43, 109, 60, 0.1);
    color: var(--chat-green);
    font-size: 0.88rem;
    font-weight: 800;
}

.holz-chat-phone-control input {
    min-height: 40px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.holz-chat-phone-control:focus-within {
    border-color: var(--chat-green);
    box-shadow: 0 0 0 3px rgba(43, 109, 60, 0.12);
}

.holz-chat-upload-hint {
    color: var(--chat-text-muted);
    font-size: 0.7rem;
    line-height: 1.25;
}

.holz-chat-upload-field input:focus,
.holz-chat-upload-field textarea:focus,
.holz-chat-upload-input:focus + .holz-chat-upload-error,
.holz-chat-upload-drop:focus-within {
    border-color: var(--chat-green);
    box-shadow: 0 0 0 3px rgba(43, 109, 60, 0.12);
}

.holz-chat-upload-field input:user-invalid,
.holz-chat-upload-field input.user-invalid-fallback,
.holz-chat-phone-control:has(input:user-invalid),
.holz-chat-phone-control:has(input.user-invalid-fallback),
.holz-chat-upload-input:user-invalid ~ .holz-chat-upload-error {
    border-color: #B42318;
}

.holz-chat-upload-error {
    display: none;
    color: #B42318;
    font-size: 0.72rem;
    line-height: 1.25;
}

.holz-chat-upload-field input:user-invalid + .holz-chat-upload-error,
.holz-chat-upload-field input.user-invalid-fallback + .holz-chat-upload-error,
.holz-chat-upload-field:has(.holz-chat-phone-control input:user-invalid) .holz-chat-upload-error,
.holz-chat-upload-field:has(.holz-chat-phone-control input.user-invalid-fallback) .holz-chat-upload-error,
.holz-chat-upload-input:user-invalid + .holz-chat-upload-error,
.holz-chat-upload-input.user-invalid-fallback + .holz-chat-upload-error {
    display: block;
}

.holz-chat-upload-drop {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 4px 10px;
    align-items: center;
    padding: 10px;
    border: 1px dashed rgba(43, 109, 60, 0.34);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.58);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.holz-chat-upload-drop:hover {
    border-color: var(--chat-green);
    background: rgba(255, 255, 255, 0.82);
}

.holz-chat-upload-icon {
    grid-row: span 2;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(43, 109, 60, 0.11);
    color: var(--chat-green);
    display: flex;
    align-items: center;
    justify-content: center;
}

.holz-chat-upload-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.holz-chat-upload-label {
    color: var(--chat-text-dark);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
}

.holz-chat-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.holz-chat-upload-submit {
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: linear-gradient(135deg, #378249 0%, #20532E 100%);
    color: #fff;
    cursor: pointer;
    font-family: var(--chat-font);
    font-size: 0.86rem;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(43, 109, 60, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.holz-chat-upload-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(43, 109, 60, 0.24);
}

.holz-chat-upload-submit:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.holz-chat-upload-status {
    min-height: 16px;
    color: var(--chat-text-muted);
    font-size: 0.75rem;
    line-height: 1.3;
}

.holz-chat-upload-status.success {
    color: var(--chat-green);
    font-weight: 700;
}

.holz-chat-upload-status.error {
    color: #B42318;
    font-weight: 700;
}

.holz-chat-submit {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #378249 0%, #20532E 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.3), 
        inset 0 -1px 2px rgba(0, 0, 0, 0.2),
        0 4px 10px rgba(43, 109, 60, 0.2);
}

.holz-chat-submit:hover {
    background: linear-gradient(135deg, #3f9453 0%, #256035 100%);
    transform: scale(1.05);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.3), 
        inset 0 -1px 2px rgba(0, 0, 0, 0.2),
        0 6px 15px rgba(43, 109, 60, 0.3);
}

.holz-chat-submit:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
    transform: none;
}

.holz-chat-submit svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    transform: translateX(1px);
}

/* Custom Disclaimer under input (if agreement already accepted) */
.holz-chat-small-disclaimer {
    font-size: 0.68rem;
    color: var(--chat-text-muted);
    text-align: center;
    padding: 0 20px 8px 20px;
    background: transparent;
    font-family: var(--chat-font);
}

.holz-chat-small-disclaimer a {
    color: var(--chat-green);
    text-decoration: underline;
}

/* Mobile Media Queries */
@media (max-width: 768px) {
    :root {
        --chat-open-trigger-size: 52px;
        --chat-open-trigger-gap: 16px;
    }

    .holz-chat-trigger {
        bottom: 20px;
        right: 20px;
    }

    .holz-chat-trigger.open {
        top: max(18px, calc(env(safe-area-inset-top, 0px) + 8px));
        right: max(var(--chat-open-trigger-gap), calc(env(safe-area-inset-right, 0px) + var(--chat-open-trigger-gap)));
        bottom: auto;
        width: var(--chat-open-trigger-size);
        height: var(--chat-open-trigger-size);
        border-radius: 50%;
        transform: none;
        touch-action: manipulation;
    }

    .holz-chat-trigger.open::before,
    .holz-chat-trigger.open::after {
        display: none;
    }

    .holz-chat-trigger.open svg {
        width: 24px;
        height: 24px;
    }
    
    .holz-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        border: none;
        transform: translateY(100%);
    }

    .holz-chat-window.open {
        transform: translateY(0);
    }
    
    .holz-chat-header {
        padding-top: max(20px, env(safe-area-inset-top, 0px));
        padding-right: calc(var(--chat-open-trigger-size) + var(--chat-open-trigger-gap) * 2);
    }
    
    .holz-chat-form {
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .holz-chat-upload-panel {
        margin: 0 12px 10px;
        max-height: 38vh;
    }

    .holz-chat-upload-panel.is-phone-mode {
        max-height: 28vh;
    }

    .holz-chat-upload-grid,
    .holz-chat-upload-panel.is-phone-mode .holz-chat-upload-grid {
        grid-template-columns: 1fr;
    }
}
